package top.lyjwn.ajui.util;

import com.google.common.base.Splitter;

import java.util.Map;

/**
 * url工具
 *
 * @author luoyujie
 */
public class UrlUtil {

//    public final static String HOST ="http://10.188.195.228:8585";
//
//    public final static String WSHOST ="ws://10.188.195.228:8585/chat/connect";

    public final static String HOST ="https://nigezhu.top/md";
    public final static String WSHOST ="wss://nigezhu.top/md/chat/connect";

    public static String getParam(String url, String name) {
        String params = url.substring(url.indexOf("?") + 1, url.length());
        try {
            Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(params);
            return split.get(name);
        }catch (IllegalArgumentException e){
            return null;
        }
    }
}
